package runesim.node.packethandler;
import org.apache.mina.common.IoSession;
import runesim.node.net.*;
import runesim.node.model.*;
public class InterfaceItemController implements PacketHandler {
	
			@Override
			@SuppressWarnings("unused")
			public void handlePacket(Packet p, IoSession session) {
				Player player = (Player) session.getAttachment();
				int frameID;
				int slot;
				int id;
				
				if(p.getId() == 145){ //Remove one item from interface
				    frameID = p.readUnsignedWordA();
					slot = p.readUnsignedWordA();
					id = p.readUnsignedWordA();
					
					if(frameID == 1688){ //Remove item from wielded items
						player.getEquipment().unwearSlot(id, slot);
					}					
				} else if(p.getId() == 117){ //Remove five items from interface
					frameID = p.readSignedWordBigEndianA();
					id = p.readSignedWordBigEndianA();
					slot = p.readSignedWordBigEndian();
				} else if(p.getId() == 43){ //Remove ten items from interface
					frameID = p.readUnsignedWordBigEndian();
					id = p.readUnsignedWordA();
					slot = p.readUnsignedWordA();
				} else if(p.getId() == 129){ //Remove all items from interface
					slot = p.readUnsignedWordA();
					frameID = p.readUnsignedWord();
					id = p.readUnsignedWordA();
				} else if(p.getId() == 135){ //Remove X amount of items from interface.
					slot = p.readSignedWordBigEndian();
					frameID = p.readUnsignedWordA();
					id = p.readSignedWordBigEndian();
				} else {
					//incorrect configuration
				}
			}	
}